# -*- coding: utf-8 -*-
# -*- frozen_string_literal: true -*-

require_relative "./../_config/minitest"
require "rbconfig"

class Test<%= @scaffold.gem_namespace %>Bin < Minitest::Test
  # Don't parallelize_me!

  def test_binstubs_return_usage_by_default
    skip "slow CLI Integration" unless ENV["<%= @scaffold.gem_constant %>_ALL_TESTS"]

    host = RbConfig::CONFIG["host_vendor"]
binstub = "<%= @scaffold.gem_name %>"
binstub += %r"alpine".match?(host) ? "-#{host}" : ""

out, _ = capture_subprocess_io { system binstub }
assert_match %r"usage:"i, out
end

def test_binstubs_permissions
binstub = "bin/<%= @scaffold.gem_name %>"

assert File.executable_real? binstub
assert File.executable_real? "#{binstub}-alpine"
end
end
